package com.woniu.dao;

import com.woniu.dto.MerchantDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

public interface MerchantMapper {

    @Select("select ai.area_name areaName,bi.id,bi.nickname nickName,bi.operationTime operationTime,bi.mailbox mailBox,create_time createTime" +
            ",bi.address,bi.introduce,bi.status from areainfo ai inner join business_info bi on ai.id=bi.plot_id order by bi.id desc")
    List<MerchantDTO> findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);

    @Update("update business_info set status=1,operationTime=#{examineTime} where id=#{id}")
    void editStatusById(@Param("id") Integer id, @Param("examineTime") Date examineTime);

    List<MerchantDTO> select(@Param("nickName") String nickName, @Param("status") Integer status);

    @Update("update business_info set status=2,operationTime=#{refuseTime} where id=#{id}")
    void refuse(@Param("id") Integer id, @Param("refuseTime") Date refuseTime);
}
